function [x,y] = ColLUDecom(A,n)
%列主元Gauss消去法
%输出L和U和p
u = zeros(1,n);
for k = 1:n-1
    [~,p] = max(abs(A(k:n,k)));
    p = p+k-1;
    tmp = A(k,1:n);
    A(k,1:n) = A(p,1:n);
    A(p,1:n) = tmp;
    u(k) = p;
    if A(k,k) ~= 0
        A(k+1:n,k) = A(k+1:n,k)/A(k,k);
        A(k+1:n,k+1:n) = A(k+1:n,k+1:n)-A(k+1:n,k)*A(k,k+1:n);
    else
        stop;
    end
end
x = A;
y = u;
end

